package com.herui.ota.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.herui.ota.entity.OpsRecord;
import com.herui.ota.entity.UserDept;
import com.herui.ota.pojo.form.DeviceOtaFilterForm;
import com.herui.ota.pojo.form.NoneFilterForm;
import com.herui.ota.pojo.form.OpsRecordFilterForm;
import com.herui.ota.service.OpsRecordService;
import com.herui.ota.service.UserDeptService;
import com.herui.ota.service.iml.BaseService;
import com.mlnx.common.annotations.NeedLogin;
import com.mlnx.common.entity.ResponseData;
import com.mlnx.common.form.PageForm;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.shan.spring.base.CurdBaseController;
import org.shan.spring.base.annotations.SysLog;
import org.shan.spring.mybatis.service.ICurdService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.util.List;

/**
 * Created by amanda.shan on 2020/5/19.
 */
@SysLog(title = "操作记录")
@Api(value = "操作记录接口", tags = {"操作记录接口"})
@RestController
@RequestMapping("/opsRecord")
public class OpsRecordController extends CurdBaseController<OpsRecord, OpsRecord, OpsRecord, OpsRecordFilterForm> {

    @Autowired
    private OpsRecordService service;

    @Override
    public ICurdService getService() {
        return service;
    }

    @Override
    public OpsRecord newInstance(Integer id) {
        OpsRecord userDept = new OpsRecord();
        userDept.setId(id);
        return userDept;
    }

    @ApiOperation("导出excel列表")
    @GetMapping("/excel")
    public void getMqttParamById(PageForm pageForm, OpsRecordFilterForm filter, HttpServletResponse response) throws IllegalAccessException {
        BaseService baseService = (BaseService) service;
        baseService.pageExcel( pageForm, filter,response);
    }

}
